package com.jk.vehicle.mini.constant;

/**
 * 出售状态枚举
 */
public enum SellStatusEnum {
    /**
     * 未售出
     */
    NO_SALE((byte)0, "未售出"),

    /**
     * 销售中
     */
    ON_SALE((byte)3, "销售中"),

    /**
     * 待出货
     */
    WAIT_SALE((byte)2, "待出货"),

    /**
     * 已售出
     */
    SOLD_OUT((byte)1, "已售出");

    private Byte code;

    private String name;

    private SellStatusEnum(Byte code, String name) {
        this.code = code;
        this.name = name;
    }

    public Byte getCode() {
        return code;
    }

    public void setCode(Byte code) {
        this.code = code;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    /**
     * 根据CODE获取枚举实例
     * @param code 枚举编号
     * @return 枚举实例
     */
    public static SellStatusEnum getEnum(Byte code){
        for(SellStatusEnum animal: SellStatusEnum.values()){
            if(animal.code.equals(code)){
                return animal;
            }
        }
        return null;
    }
}
